package com.zhong.gang.applib.utils;

import java.text.DecimalFormat;

public class NumberUtils {
    private static final DecimalFormat df = new DecimalFormat(".00");

    public static final String getStrNumber(double number){
        return df.format(number);
    }
    public static final String getStrNumber(String number){
        double numberDouble = 0.00;
        try {
            numberDouble = Double.parseDouble(number);
        }catch (Exception e){}
        return getStrNumber(numberDouble);
    }

    public static final double getNumber(double number){
        double newNumber = 0.00;
        try {
            newNumber = Double.parseDouble(getStrNumber(number));
        }catch (Exception e){}
        return newNumber;
    }

    public static final double getNumber(String number){
        double newNumber = 0.00;
        try {
            newNumber = Double.parseDouble(getStrNumber(number));
        }catch (Exception e){}
        return newNumber;
    }
}
